<?php
/**
 * Page Template
 *
 * Loaded automatically by index.php?main_page=product_info.<br />
 * Displays details of a typical product
 *
 * @package templateSystem
 * @copyright Copyright 2003-2006 Zen Cart Development Team
 * @copyright Portions Copyright 2003 osCommerce
 * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
 * @version $Id: tpl_product_info_display.php 16242 2010-05-08 16:05:40Z ajeh $
 */
 //require(DIR_WS_MODULES . '/debug_blocks/product_info_prices.php');
?>
<table height="312" cellspacing="0" cellpadding="0" border="0" id="ctr-item-detl-content">
<tr><td colspan="3">
<?php  echo zen_draw_separator($image = 'pixel_trans.gif', '1', '10');?>
</td></tr>

<tr><td width="250" valign="top" height="320" align="center"><div style="width:250px; height:320px; overflow:hidden;"><center>
<?php
  if (zen_not_null($products_image)) {
  ?>
<?php
/**
 * display the main product image
 */
   require($template->get_template_dir('/tpl_modules_main_product_image.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_modules_main_product_image.php'); ?>
<?php
  }
?>
</div>
</center></td><!--Middle space Next to image-->

<td width="5"><?php echo zen_image(DIR_WS_TEMPLATE_IMAGES.'/spacer.gif',5,1);?></td>
<!--bof Form start-->
      <!--bof Form start-->
<?php echo zen_draw_form('cart_quantity', zen_href_link(zen_get_info_page($_GET['products_id']), zen_get_all_get_params(array('action')) . 'action=add_product', $request_type), 'post','enctype="multipart/form-data" class="item-prodinfo-add2cart"') . "\n"; ?>
<!--eof Form start-->
<!--eof Form start-->

<?php if ($messageStack->size('product_info') > 0) echo $messageStack->output('product_info'); ?>

<!--bof Category Icon -->
<?php if ($module_show_categories != 0) {?>
<?php
/**
 * display the category icons
 */
require($template->get_template_dir('/tpl_modules_category_icon_display.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_modules_category_icon_display.php'); ?>
<?php } ?>
<!--eof Category Icon -->

<!--bof Prev/Next top position -->
<?php if (PRODUCT_INFO_PREVIOUS_NEXT == 1 or PRODUCT_INFO_PREVIOUS_NEXT == 3) { ?>
<?php
/**
 * display the product previous/next helper
 */
require($template->get_template_dir('/tpl_products_next_previous.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_products_next_previous.php'); ?>
<?php } ?>
<!--eof Prev/Next top position-->

<!--bof Main Product Image -->
<td width="513" valign="top">
  <!-- Desc table Start -->
  <div class="prodinfo">
    <table cellspacing="0" cellpadding="0" border="0" units="px" id="ctr-item-info-content">
      <tbody>
        <tr>
          <td valign="top" colspan="2">
            <div class="itemProdInfoTop">
              <h1 class="itemProdInfoTitle"><?php echo $products_name; ?></h1>
              <div>
                <span class="itemProdInfoSize11"> <?php echo (($flag_show_product_info_model == 1 and $products_model !='') ? TEXT_PRODUCT_MODEL . $products_model  : '') . "\n"; ?>
                </span>
                <span id="itemRatingReviews">
                  <span style="padding-left: 10px; padding-right: 10px;">|</span>
                  <span class="itemProdInfoSize11"><?php if(zen_get_reviewsAll($_GET['products_id'])){echo 'Customer Reviews:</span>'. zen_get_reviewsAll($_GET['products_id']);}else{echo '<a href="' . zen_href_link(FILENAME_PRODUCT_REVIEWS_WRITE, zen_get_all_get_params(array())) . '">Click here to review this product</a></span>'; } ?>  
                </span>
              </div>
            </div>
          </td>
        </tr>
        <tr>
          <td align="center" style="font-size: 0px;" colspan="2"><?php echo zen_image(DIR_WS_TEMPLATE_IMAGES.'/img-item-prodinfo-greyline.jpg'); ?></td>
        </tr>
        <tr>
          <td valign="top" align="center" class="itemProdInfoLeft">
            <div class="itemProdMiddleLine">
              <div class="itemProdInfoMiddleLeft">
                <table width="100%" cellspacing="0" cellpadding="0" border="0">
                  <tbody>
                    <tr>
                      <td>
                        <div class="itemProdInfoSize12">
                          <div style="float: left;">
                            Retail Price:
                          </div>
                          <div style="float: right;">
                          <?php echo    $currencies->display_price(zen_get_products_base_price($_GET['products_id'])); ?>
                          </div>
                        </div>
                      </td>
                    </tr>
                    <tr>
                      <td style="padding-top: 10px;">
                        <div class="itemProdInfoSize10">
                          <div style="float: left;">
                            Instant Savings:
                          </div>
                          <div style="float: right;">
                           <?php
if(zen_get_products_special_price($_GET['products_id'])!=''){
	$now_price=zen_get_products_special_price($_GET['products_id']);
}else{
	$now_price=zen_get_products_display_price($_GET['products_id']);
	
}
if(zen_get_products_special_price($_GET['products_id'])!=''){
        echo $currencies->display_price((zen_get_products_base_price($_GET['products_id']) - $now_price), zen_get_tax_rate($product_check->fields['products_tax_class_id']));
        echo '('.number_format(100 - (((zen_get_products_base_price($_GET['products_id']) - $now_price)/ zen_get_products_base_price($_GET['products_id'])) * 100)).'%)';
}else{
	echo '0';
	
} ?>
                          </div>
                        </div>
                      </td>
                    </tr>

                  </tbody>
                </table>
              </div>
              <div class="itemProdInfoLeftLine">
              <?php echo zen_image(DIR_WS_TEMPLATE_IMAGES . 'img-item-prodinfo-orangeline.jpg','',290,1) ;?>
              </div>
              <div class="itemProdInfoBottomLeft">
                <table width="100%" cellspacing="0" cellpadding="0" border="0">
                  <tbody>
                    <tr>
                      <td style="padding-bottom: 5px;">
                        <div>
                          <div style="float: left;" class="itemProdInfoTotalPriceText">
                            Our Price:
                          </div>
                          <div style="float: right;" class="itemProdInfoTotalPriceValue">
                             <?php
							  if(zen_get_products_special_price($_GET['products_id'])!=''){
                           	          echo   $currencies->display_price(zen_get_products_special_price($_GET['products_id']));
                                }else{
                                	 echo   $currencies->display_price(zen_get_products_display_price($_GET['products_id']));
                                	
                                }
                                ?>
                          </div>
                        </div>
                      </td>
                    </tr>
                    <tr>
                      <td>
                        <div>
                  
                            <div id="WeeklySpecialsDiv">
                            </div>
                            <div style="float: left; height: 30px; line-height: 30px; vertical-align: middle;" class="itemProdInfoSize12">
                              <span style="padding-right: 3px;">
                                Qty:
                              </span>
                              
                           <?php 
                           $the_button='<input type="text" name="cart_quantity" value="'.(zen_get_buy_now_qty($_GET['products_id'])).'" id="quantity" style="width: 35px; vertical-align: middle;"/>';
                           echo $display_button = zen_get_buy_now_button($_GET['products_id'], $the_button);
                           echo  zen_draw_hidden_field('products_id', (int)$_GET['products_id']); ?>
                               </div>
                            <div style="float: right;">
                              <input type="IMAGE" id="" src="<?php echo DIR_WS_TEMPLATE_IMAGES ; ?>addtocart_l.jpg">
                            </div>            
                        </div>
                      
                      </td>
                    </tr>
                    <tr>
                      <td valign="top">
                        <div style="padding-top: 5px;" class="itemProdInfoSize12">
                          Usually ships the same business day.
                          <!--bof Attributes Module -->



                        </div>
                      </td>
                    </tr>
                  </tbody>
                </table>
              </div>
            </div>
          </td>
          <td valign="top">
            <div class="itemProdInfoMiddleRight">
              <table width="100%" cellspacing="0" cellpadding="0" border="0">
                <tbody>
                  <tr>
                    <td valign="top">
                     
                        <?php 
                      if($products_quantity>0){
                        ?>
                         <div class="itemProdInfoIcon">
                        <?php echo zen_image(DIR_WS_TEMPLATE_IMAGES . 'img-icon-instock.gif') ;?>
                        <span class="itemProdInfoSize11 itemProdInfoIconText">
                          &nbsp;&nbsp;In stock
                        </span>
                      </div>
                      <?php }else{
                      
                      	 echo '    <div class="itemProdInfoIcon">'.zen_image(DIR_WS_TEMPLATE_IMAGES . 'img-icon-nostock.gif').'
                        <span class="itemProdInfoSize11 itemProdInfoIconText">
                          &nbsp;&nbsp;Out of stock
                        </span>
                      </div>';
                      }
                      
                 
                      if(zen_get_products_special_price($_GET['products_id'])!=''){
                      	?>
                      <div class="itemProdInfoIcon">
                         <?php echo zen_image(DIR_WS_TEMPLATE_IMAGES . 'img-icon-promotion.gif'); ?>
                        <span class="itemProdInfoSize11 itemProdInfoIconText">
                          &nbsp;&nbsp;Promotion
                        </span>
                      </div>
                      <?php } ?>
                    </td>
                  </tr>
                </tbody>
              </table>
            </div>
            <div class="itemProdInfoRemarks">
              <span style="padding-left: 12px;">
                Remarks
              </span>
            </div>
            <div class="itemProdInfoBottomRight">
              <div class="itemProdInfoCoupon">
             <?php echo zen_trunc_string( $products_remarks) ?>
              </div>
              <div class="itemProdInfoSize12">
              </div>
              <div class="prodinfo-remarksvalue" id="RemarksValue">
              </div>
            </div>
          </td>
        </tr>
      </tbody>
    </table>
  </div>
  <!-- Desc table End -->
</td>
</tr>
<tr><td colspan="3"><a name="desc"></a><table cellspacing="0px" cellpadding="0px"><tbody><tr>
<!-- Left Tab (Main)-->
<td width="525" valign="top">
<table cellspacing="0px" cellpadding="0px" width="525"><tbody><tr>

<td><div class="tabheader spacing" id="tabheader"><ul class="spacing">
<li onclick="selecttab(1)" class="current" id="menu1"><a>Description</a></li>
<li onclick="selecttab(2)" id="menu2"><a>Quantity Discounts</a></li>
<li onclick="selecttab(3)" id="menu3"><a>Compatibility </a></li>
<li onclick="selecttab(4)" id="menu4"><a>Customer Reviews</a></li>
<li onclick="selecttab(5)" id="menu5"><a>Shipping</a></li></ul></div></td></tr>


<tr><td class="itemdesc">

<div class="itemdescmain" id="tab1"><span id="itemdetl_desc" class="item-desc-main"><div id="ItemDescription">
         <?php
  if ($pr_attr->fields['total'] > 0) {
?>
<?php
/**
 * display the product atributes
 */
//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  require($template->get_template_dir('/tpl_modules_attributes.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_modules_attributes.php'); ?>
<?php
  }
?>
<!--eof Attributes Module -->  

<?php echo stripslashes($products_description); ?>

</div><br></span></div>


<div class="itemtab itemdescmain" id="tab2" style="display:none"><span class="item-desc-main">
<!--bof Quantity Discounts table -->
<?php
  if ($products_discount_type != 0) { ?>
<?php
/**
 * display the products quantity discount
 */
 require($template->get_template_dir('/tpl_modules_products_quantity_discounts.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_modules_products_quantity_discounts.php'); ?>
<?php
  }else{
  	echo 'No Quantity Discounts!';
  }
?>
<!--eof Quantity Discounts table -->
</span></div>

<div class="itemtab itemdescmain" id="tab3" style="display:none"><span class="item-desc-main">
<?php if($products_compatibility!=''){
 
echo $products_compatibility;

}else{
echo '<br><b>Compatibility Information Not Available</b>';
}
?>
</span></div>


<div class="itemtab itemdescmain" id="tab4" style="display:none"><span id="CustomerReviews" class="item-desc-main"><div id="reviews">




<!--bof Reviews button and count-->
 <?php
  if ($flag_show_product_info_reviews == 1) {
     if ($reviews->RecordCount() > 0 ) { 
     	?>	<div class="writereview"><?php echo '<a href="' . zen_href_link(FILENAME_PRODUCT_REVIEWS_WRITE, zen_get_all_get_params(array())) . '">Click here to review this product</a>'; ?>
<br><small>(Reviews are subject to approval)</small>
</div>
     	<?php 
	     while (!$reviews->EOF){
	    				$customer_name = substr($reviews->fields['customers_name'],strpos($reviews->fields['customers_name'],' '));
	    				if(!isset($customer_name)){
	    					$customer_name = $reviews->fields['reviews_id'];
	    				}
	    	?>
				<ul class="border_b margin_t pad_bottom">
				<?php for( $i = 0;$i < $reviews->fields['reviews_rating'];$i++){?>
							<span class="star"></span>
				<?php } ?>
				<?php if ( $reviews->fields['reviews_rating']<5){
								for( $i = 0;$i < 5-$reviews->fields['reviews_rating'];$i++){
									echo '<span class="star_gray"></span>';
								}
							}?>
				&nbsp;<strong><?php echo $reviews->fields['reviews_title']; ?></strong>, <?php echo zen_date_short($reviews->fields['date_added']);?>  <?php if($reviews->fields['reviews_is_featured']){echo '<span style="font-size: 10px;"> ( <a href="'.zen_href_link(FILENAME_TESTIMONIALS).'" class="u">'.TEXT_PRODUCT_FEATURED_REVIEW.'</a> ) </span>';} ?><br/><?php echo $customer_name; ?><div style="" class="gray big"><?php echo $reviews->fields['reviews_text'] ?></div>
				</ul>
			<?php $reviews->MoveNext();
					} ?>
      </div>
    <?php } else {
    	?>
    	<div class="writereview"><?php echo '<a href="' . zen_href_link(FILENAME_PRODUCT_REVIEWS_WRITE, zen_get_all_get_params(array())) . '">Be the first to review this product</a>'; ?>
<br><small>(Reviews are subject to approval)</small>
</div>
    	<?
    		
    	}?>

<?php } ?>
</div></span></div>




<div class="itemtab itemdescmain" id="tab5" style="display:none"><span class="item-desc-main"><table cellspacing="0" cellpadding="0" border="0"><tbody><tr><td valign="top" colspan="2">

<?php
if(!zen_get_product_is_always_free_shipping((int)$_GET['products_id'])) {
/**
 * display the products shipping
 */
  //require(DIR_WS_MODULES . zen_get_module_directory('product_shipping_estimator.php'));
  require($template->get_template_dir('/tpl_modules_product_shipping_input.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_modules_product_shipping_input.php');
}
?>
</td></tr></tbody></table></span></div></td></tr>


<tr><td class="itembottom">
<a href="<?php echo zen_href_link(FILENAME_TELL_A_FRIEND,'products_id='.$_GET[products_id]); ?>" target="_blank"  id="element-typ-item-page-email" class="item-prodinfo-button"><?php 
echo zen_image(DIR_WS_TEMPLATE_IMAGES . 'item-ico-email.jpg');?>
</a>
<?php 
echo zen_image(DIR_WS_TEMPLATE_IMAGES . 'item-ico-print.jpg','Print this page','66px','27px','onclick="javascript:printpage();" id="element-typ-item-page-print" class="item-prodinfo-button"');?>

<a href="mailto:<?php  echo STORE_OWNER_EMAIL_ADDRESS;?>"><?php 
echo zen_image(DIR_WS_TEMPLATE_IMAGES . 'item-ico-question.jpg');?></a>

<?php echo zen_back_link() ?><?php 
echo zen_image(DIR_WS_TEMPLATE_IMAGES . 'item-ico-returns.jpg');?></a></td></tr></tbody></table>
</td><!-- Middle Space-->

<td width="8">

</td>

<!-- Right Tab (Related Item)-->
<td width="240px" class="itemstab">
<?php require(DIR_WS_MODULES.'product_info_featured_products.php') ;?>
</td>

</tr></tbody></table></td></tr>

<!--eof Main Product Image-->

</table>


<!--bof Form close-->
</form>
<!--bof Form close-->
